<template>
	<view class="">
		<view class="u-padding-20">
			<u-form :model="form" ref="uForm" label-width="160">
				
				<u-form-item label="姓名" prop="nickname" label-position="top">
					<u-input disabled  v-model="info.nickname" type="text"  placeholder="" />
				</u-form-item>
				
				<u-form-item label="会员等级" prop="nickname" label-position="top">
					<u-input disabled  v-model="info.levelName" type="text"  placeholder="" />
				</u-form-item>
				
	
				<u-form-item  label="加入时间" prop="safe_password" label-position="top">
					
					<u-input disabled  v-model="info.createTime"  placeholder=""  />
				</u-form-item>

			</u-form>
		</view>

		<!-- <view class="bottomFix">
			<u-button @click="submit" :custom-style="{background:'#F03033',color:'#fff'}" >提交</u-button>
		</view> -->


		<u-toast ref="uToast" />


	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:{},
				form: {
					safe_password:"",
					nickname:''
				},
				rules: {
					safe_password: [{

						required: true,
						message: '请输入安全密码',
						// 可以单个或者同时写两个触发验证方式 
						trigger: ['change', 'blur'],
					}],

					nickname: [{
						required: true,
						message: '请输入姓名',
						// 可以单个或者同时写两个触发验证方式 
						trigger: ['change', 'blur'],
					}],
				}
			};
		},
		created() {
			this.userInfo()
		},
		
		
		methods: {
			userInfo() {
				return new Promise((resolve, reject) => {
					this.$u.api.userInfo().then(res => {
						this.info = res;
						resolve(res)
					
					}).catch(err => {
			
					})
				})
			
			}
			// submit() {
			// 	this.$refs.uForm.validate(valid => {
			// 		if (valid) {
			// 			this.$u.post('/api/user/saveInfo', this.form).then(res => {
			// 				this.$refs.uToast.show({
			// 					title: '修改成功',
			// 					type: 'success',
			// 					back: true
			// 				})
			// 			}).catch(err => {

			// 			})
			// 		} else {
			// 			console.log('验证失败');
			// 		}
			// 	});
			// }
		},
		// 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		}
	};
</script>


<style scoped>

</style>
